export default {
    namespaced: true,
    // 数据
    state: {
        // 控制是否显示弹出狂
        isShowToast: false,
        // 提水内容
        toastMsg: '',
        // 提示类型  (success,danger,warning)
        toastType: ""
    },
    mutations: {
        changeisshowToast(state, payload) {
            state.isShowToast = payload.show;
            if (payload.show) {
                state.toastMsg = payload.msg;
                state.toastType = payload.type;
            }
        }
    },
    actions: {
        asyncIsShowToast(context, payload) {
            context.commit("changeisshowToast", payload);
            // 自动隐藏提示框
            setTimeout(() => {
                context.commit('changeisshowToast', { show: false })
            }, 2000);
        }
    }
}
